home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / utility3 / netbios.zip / NETBIOS.H < prev    next >
C/C++ Source or Header  |  1991-11-08  |  7KB  |  180 lines

  1.  
  2. /*
  3.  * Copyright (c) 1991 Darryl Collins.
  4.  * All rights reserved.
  5.  *
  6.  * Redistribution and use in source and binary forms are permitted
  7.  * provided that the above copyright notice and this paragraph are
  8.  * duplicated in all such forms and that any documentation,
  9.  * advertising materials, and other materials related to such
  10.  * distribution and use acknowledge that the software was developed
  11.  * by Darryl Collins, University of western Australia.  The name of the
  12.  * University may not be used to endorse or promote products derived
  13.  * from this software without specific prior written permission.
  14.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  15.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  16.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  17.  */
  18.  
  19.  
  20. /*
  21.  * Please send questions, comments and bug-reports to
  22.  *
  23.  *               darryl@fibula.surgery.uwa.oz.au
  24.  *
  25.  * Sources to the DLL are available upon request.
  26.  */
  27.  
  28. /* #include "windows.h" */
  29.  
  30. #define NB_WAIT           0x00                  /*  Wait for completion          */
  31. #define NB_NOWAIT         0x80         /*  Do no wait for completion*/
  32.  
  33. #define NB_RESET          0x32         /*  Reset adapter                         */
  34. #define NB_CANCEL         0x35         /*  Cancel command                        */
  35. #define NB_ASTATUS        0x33         /*  Get NETBIOS intf status       */
  36. #define NB_UNLINK         0x70         /*  Unlink   (RPL)                        */
  37.  
  38. #define NB_ADDNAME        0x30         /*  Add name                              */
  39. #define NB_ADDGROUP       0x36         /*  Add group name                        */
  40. #define NB_DELNAME        0x31         /*  Delete name                           */
  41.  
  42. #define NB_CALL           0x10         /*  Call                                  */
  43. #define NB_LISTEN         0x11         /*  Listen                                        */
  44. #define NB_HANGUP         0x12         /*  Hang up                                       */
  45. #define NB_SEND           0x14         /*  Send                                  */
  46. #define NB_SENDNACK       0x71         /*  Send                                  */
  47. #define NB_CHSEND         0x17         /*  Chain send                            */
  48. #define NB_CHSENDNACK     0x72         /*  Chain send                            */
  49. #define NB_RECEIVE        0x15         /*  Receive                                       */
  50. #define NB_RECANY         0x16         /*  Receive any                           */
  51. #define NB_SESSTATUS      0x34         /*  Get session status            */
  52.  
  53. #define NB_SDATAGRAM      0x20         /*  Send datagram                         */
  54. #define NB_SBROADCAST     0x22         /*  Send broadcast                        */
  55. #define NB_RDATAGRAM      0x21         /*  Receive datagram              */
  56. #define NB_RBROADCAST     0x23         /*  Receive broadcast             */
  57.  
  58. struct Ncb;
  59.  
  60. typedef struct Ncb      NCB;
  61. typedef HANDLE          HNCB;
  62. typedef NCB far *       LPNCB;
  63.  
  64. struct Ncb {
  65.  
  66.     unsigned char   NcbCommand;
  67.     unsigned char   NcbRetCode;
  68.     unsigned char   NcbLsn;
  69.     unsigned char   NcbNum;
  70.  
  71.     LPSTR                   NcbBuffer;
  72.     unsigned int    NcbLength;
  73.  
  74.     char                    NcbCallName[16];
  75.     char                    NcbName[16];
  76.  
  77.     unsigned char   NcbRto;
  78.     unsigned char   NcbSto;
  79.  
  80.     FARPROC                 NcbPostRoutine;
  81.  
  82.     unsigned char   NcbLanaNum;
  83.     unsigned char   NcbCmdCmplt;
  84.  
  85.     char                    NcbReservedArea[14];
  86.  
  87.     HWND                    hWnd;
  88.     HANDLE                  hNcb;
  89.  
  90.     LPNCB                   lpNext;
  91.     LPNCB                   lpPrev;
  92. };
  93.  
  94. extern LPNCB            lpNcbList;
  95.  
  96. typedef struct {
  97.     unsigned char           bssNameNum;
  98.     unsigned char           bssNumSessions;
  99.     unsigned char           bssPendingRecDataGram;
  100.     unsigned char           bssPendingRecAny;
  101. } BASESESSIONSTATUS;
  102.  
  103. typedef struct {
  104.     unsigned char           ssLsn;
  105.     unsigned char           ssState;
  106.     char                            ssLocalName[16];
  107.     char                            ssRemoteName[16];
  108.     unsigned char           ssPendingReceives;
  109.     unsigned char           ssPendingSends;
  110. } SESSIONSTATE;
  111.  
  112. typedef struct {
  113.     BASESESSIONSTATUS       bss;
  114.     SESSIONSTATE            ss[10];
  115. } SESSIONSTATUS;
  116.  
  117. typedef struct {
  118.     char    szNodeName[6];
  119.     char    cMajorVersion;
  120.     char    cReserved;
  121.     char    cAdapterType;
  122.     char    cMinorVersion;
  123.     int             nReportPeriod;
  124.     int             nReceiveReject;
  125.     int             nTransmitReject;
  126.     int             nReceiveError;
  127.     int             nTransmitAbort;
  128.     long    lTransmitCount;
  129.     long    lReceiveCount;
  130.     int             nTransmitError;
  131.     int             nRemoteDepletion;
  132.     int             nExpiredT1;
  133.     int             nExpiredTi;
  134.     LPSTR   lpExtStatus;
  135.     int             nFreeCmdBlks;
  136.     int             nMaxPendingNCBs;
  137.     int             nMaxCommands;
  138.     int             nTransmitDepletion;
  139.     int             nMaxPacketSize;
  140.     int             nPendingSessions;
  141.     int             nMaxPendingSessions;
  142.     int             nMaxSessions;
  143.     int             nMaxSessionPacketSize;
  144.     int             nNameTableEntries;
  145. } ADAPTERSTATUS;
  146.  
  147.  
  148. LPNCB FAR PASCAL Reset(HWND hWnd,unsigned char nLsn, unsigned char nNum);
  149. LPNCB FAR PASCAL AdapterStatus(HWND hWnd,LPSTR lpCallName, LPSTR lpStatBuf, unsigned nLength, BOOL bWait);
  150. LPNCB FAR PASCAL Cancel(HWND hWnd,LPNCB lpNcb);
  151. LPNCB FAR PASCAL Unlink(HWND hWnd);
  152.  
  153. LPNCB FAR PASCAL AddName(HWND hWnd,LPSTR lpName, BOOL bWait);
  154. LPNCB FAR PASCAL DeleteName(HWND hWnd,LPSTR lpName, BOOL bWait);
  155. LPNCB FAR PASCAL AddGroupName(HWND hWnd,LPSTR lpName, BOOL bWait);
  156.  
  157. LPNCB FAR PASCAL Call(HWND hWnd,LPSTR lpCallName, LPSTR lpName, BOOL bWait);
  158. LPNCB FAR PASCAL Listen(HWND hWnd,LPSTR lpCallName, LPSTR lpName, BOOL bWait);
  159. LPNCB FAR PASCAL HangUp(HWND hWnd,unsigned char nLsn, BOOL bWait);
  160. LPNCB FAR PASCAL Send(HWND hWnd,unsigned char nLsn, LPSTR lpBuffer, unsigned nLength, BOOL bWait);
  161. LPNCB FAR PASCAL Receive(HWND hWnd,unsigned char nLsn, LPSTR lpBuffer, unsigned nLength, BOOL bWait);
  162. LPNCB FAR PASCAL ReceiveAny(HWND hWnd,unsigned char nNum, LPSTR lpBuffer, unsigned nLength, BOOL bWait);
  163. LPNCB FAR PASCAL ChainSend(HWND hWnd,unsigned char nLsn, LPSTR lpBuf0, unsigned nLength0, LPSTR lpBuf1, unsigned nLength1, BOOL bWait);
  164. LPNCB FAR PASCAL SessionStatus(HWND hWnd,LPSTR lpBuffer, unsigned nLength, LPSTR lpName, BOOL bWait);
  165. LPNCB FAR PASCAL SendNoAck(HWND hWnd,unsigned char nLsn, LPSTR lpBuffer, unsigned nLength, BOOL bWait);
  166. LPNCB FAR PASCAL ChainSendNoAck(HWND hWnd,unsigned char nLsn, LPSTR lpBuf0, unsigned nLength0, LPSTR lpBuf1, unsigned nLength1, BOOL bWait);
  167.  
  168. LPNCB FAR PASCAL SendDatagram(HWND hWnd,unsigned char nNum, LPSTR lpBuffer, unsigned nLength, LPSTR lpCallName, BOOL bWait);
  169. LPNCB FAR PASCAL ReceiveDatagram(HWND hWnd,unsigned char nNum, LPSTR lpBuffer, unsigned nLength, BOOL bWait);
  170. LPNCB FAR PASCAL SendBroadcastDatagram(HWND hWnd,unsigned char nNum, LPSTR lpBuffer, unsigned nLength, BOOL bWait);
  171. LPNCB FAR PASCAL ReceiveBroadcastDatagram(HWND hWnd,unsigned char nNum, LPSTR lpBuffer, unsigned nLength, BOOL bWait);
  172.  
  173. void FAR PASCAL  ReleaseNcb(LPNCB lpNcb);
  174. LPSTR FAR PASCAL AllocFixedBuffer(unsigned int);
  175. void FAR PASCAL  FreeFixedBuffer(LPSTR);
  176.  
  177.  
  178.  
  179. #define NB_COMMAND      0xdcdc
  180.